package com.cmcc.waf.report.feign.model;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * WEB安全防护
 *
 * @author wangxishou
 * @date 2024/11/04 14:14
 */
@Data
public class WebSafeInfoVO {

    @ApiModelProperty(value = "web事件统计")
    private EventCount eventCount;

    @ApiModelProperty(value = "攻击事件TOP")
    private List<AttackEventTop> attackEventTopList;

    @ApiModelProperty(value = "攻击分布区域")
    private List<AttackRegions> attackRegionsList;

    @ApiModelProperty(value = "威胁主机TOP")
    private List<ThreatHostTop> threatHostTopList;

    @ApiModelProperty(value = "客户端IP TOP")
    private List<SrcIpTop> srcIpTopList;

    @ApiModelProperty(value = "告警威胁分类")
    private List<ThreatType> threatTypeList;

    @ApiModelProperty(value = "告警等级分布")
    private List<AlarmLevel> alarmLevelList;

    /*public WebSafeInfoVO(Integer code, String msg, Object data) {
        this.code = String.valueOf(code);
        this.message = msg;
        if (data instanceof EventCount) {
            this.eventCount = (EventCount) data;
        } else if (data instanceof List<?>) {
            List<?> list = (List<?>) data;
            if (!list.isEmpty()) {
                if (list.get(0) instanceof AttackEventTop) {
                    this.attackEventTopList = (List<AttackEventTop>) data;
                } else if (list.get(0) instanceof AttackRegions) {
                    this.attackRegionsList = (List<AttackRegions>) data;
                } else if (list.get(0) instanceof ThreatHostTop) {
                    this.threatHostTopList = (List<ThreatHostTop>) data;
                } else if (list.get(0) instanceof SrcIpTop) {
                    this.srcIpTopList = (List<SrcIpTop>) data;
                } else if (list.get(0) instanceof ThreatType) {
                    this.threatTypeList = (List<ThreatType>) data;
                } else if (list.get(0) instanceof AlarmLevel) {
                    this.alarmLevelList = (List<AlarmLevel>) data;
                } else {
                    this.data = data;
                }
            }
        } else {
            this.data = data;
        }
    }*/

    @Data
    public static class EventCount {
        @ApiModelProperty(value = "告警次数")
        private Integer alarmCount;

        @ApiModelProperty(value = "拦截次数")
        private Integer interceptCount;

        @ApiModelProperty(value = "高危")
        private Integer highDangerCount;

        @ApiModelProperty(value = "中危")
        private Integer middleDangerCount;

        @ApiModelProperty(value = "低危")
        private Integer lowerDangerCount;
    }

    @Data
    public static class AttackEventTop {
        @ApiModelProperty(value = "类型")
        private String name;

        @ApiModelProperty(value = "数量")
        private Integer count;

        @ApiModelProperty(value = "占比")
        private Integer proportion;
    }

    @Data
    public static class AttackRegions {
        @ApiModelProperty(value = "国家")
        private String attackerGeoCountry;

        @ApiModelProperty(value = "城市")
        private String srcGeoCity;

        @ApiModelProperty(value = "维度")
        private String attackerGeoLongitude;

        @ApiModelProperty(value = "经度")
        private String attackerGeoLatitude;

        @ApiModelProperty(value = "攻击统计")
        private Integer count;
    }

    @Data
    public static class ThreatHostTop {
        @ApiModelProperty(value = "威胁主机")
        private String name;

        @ApiModelProperty(value = "统计")
        private Integer count;
    }

    @Data
    public static class SrcIpTop {
        @ApiModelProperty(value = "ip")
        private String name;

        @ApiModelProperty(value = "统计")
        private Integer count;
    }

    @Data
    public static class ThreatType {
        @ApiModelProperty(value = "名称")
        private String name;

        @ApiModelProperty(value = "数量")
        private Integer count;

        @ApiModelProperty(value = "比例")
        private Integer proportion;
    }

    @Data
    public static class AlarmLevel {
        @ApiModelProperty(value = "名称")
        private String name;

        @ApiModelProperty(value = "数量")
        private Integer count;

        @ApiModelProperty(value = "比例")
        private Integer proportion;
    }

    @Data
    public static class QpsTrend {
        @ApiModelProperty(value = "时间")
        private String time;

        @ApiModelProperty(value = "统计")
        private Integer count;
    }

    @Data
    public static class AlarmTrend {
        @ApiModelProperty(value = "时间")
        private String time;

        @ApiModelProperty(value = "统计")
        private Integer count;
    }

    @Data
    public static class AttackRegion {
        @ApiModelProperty(value = "源国家")
        private String srcGeoCountry;
        private String srcGeoCity;
        private String srcGeoLongitude;
        private String srcGeoLatitude;
        @ApiModelProperty(value = "目的国家")
        private String dstGeoCountry;
        private String dstGeoCity;
        private String dstGeoLongitude;
        private String dstGeoLatitude;
        @ApiModelProperty(value = "统计次数")
        private Integer count;
    }

    @Data
    public static class HealthScore {
        @ApiModelProperty(value = "分数")
        private Integer score;
        @ApiModelProperty(value = "危险级别")
        private String text;
    }

}
